﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demo02
{
    class Program
    {
        static void Main(string[] args)
        {
            double[] scores = new double[5];
            double sum = 0;
            double avg = 0;
            Console.WriteLine("输入五个学生的成绩");
            for (int i = 0; i < 5; i++)
            {
                Console.WriteLine("输入第{0}个学生成绩", i + 1);
                scores[i] = double.Parse(Console.ReadLine());
            }
            foreach (var num in scores)
            {
                sum = sum + num;
                avg = sum / 5;
            }
            Console.WriteLine("总成绩为{0}", sum);
            Console.WriteLine("平均成绩为{0}", avg);
        }
    }
}
